import { memo, useState } from "react";

const MemoChild = memo(function MemoChild({count,onClick}:{count:number,onClick:()=>void}) {
    console.log("memoChild");
    const [age, setAge] = useState(0);
    return ( 
        <div>
            <h1>memoChild</h1>
            <h2>count: {count}</h2>
            <button onClick={onClick}>Click me</button>
            <h2>age: {age}</h2>
            <button onClick={() => setAge(age + 1)}>age: {age}</button>
        </div>
      );
})

export default MemoChild;